package q2d.client.renderers;

/** DisplaysRenderer:
 * Klasa renderujaca widok wyswietlaczy.
 */
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;

import q2d.client.Game;
import q2d.common.models.units.Player;

public class DisplaysRenderer extends Renderer {

	private final String CONNECTED_MESSAGE = "CONNECTED";
	private final String DISCONNECTED_MESSAGE = "DISCONNECTED";

	public int redTeamScore = 0;
	public int blueTeamScore = 0;
	public int playerHP = 100;

	private Font displaysFontSmall = new Font("Tahoma", Font.BOLD, 13);
	private Font displaysFontBig = new Font("Tahoma", Font.BOLD, 18);


	/**
	 * Konstruktor.
	 * @param game_width
	 * @param game_height
	 * @param game_world referencja obiektu GameWorld ktory ma byc renderowany
	 */
	public DisplaysRenderer(int game_width, int game_height){
		super(game_width, game_height);
	}

	@Override
	public void draw(Graphics2D g, int server_connection_state) {
		// biezacy status polaczeia z serwerem
		if (server_connection_state == Game.CONNECTION_STATE_CONNECTED){
			g.setColor(Color.WHITE);
			g.setFont(displaysFontSmall);
			g.drawString(CONNECTED_MESSAGE, 302, 103);
		} else {
			g.setColor(Color.RED);
			g.setFont(displaysFontSmall);
			g.drawString(DISCONNECTED_MESSAGE, 302, 103);
		}

		// punktacja
		g.setFont(displaysFontSmall);
		g.drawString(String.valueOf(redTeamScore), 245, 72);
		g.drawString(String.valueOf(blueTeamScore), 296, 72);

		// hp
		g.setFont(displaysFontBig);
		g.drawString(String.valueOf(playerHP), 212, 43);
	}
}
